package com.ctz.commonframe.ui.widget;

import android.support.v7.widget.RecyclerView;
import android.util.SparseArray;
import android.view.View;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by 陈堂正 on 2016/12/5.
 */
public class BaseRecycleViewHolder extends RecyclerView.ViewHolder {
    private View itemView;
    private SparseArray<View> views;

    public BaseRecycleViewHolder(View itemView) {
        super(itemView);
        this.itemView = itemView;
    }

    public <T extends View> T getView(int viewId) {
        View view = views.get(viewId);
        if (view == null) {
            view = itemView.findViewById(viewId);
            views.put(viewId, view);
        }
        return (T) view;
    }
}
